#!/bin/sh
# - runtime
# - nr_threads
# - table_size

## OLTP (On-line Transaction Processing) is characterized by a large
## number of short on-line transactions (INSERT, UPDATE, DELETE).
## The main emphasis for OLTP systems is put on very fast query
## processing, maintaining data integrity in multi-access
## environments and an effectiveness measured by number
## of transactions per second.

[ -n "$runtime" ] || runtime=600
[ -n "$table_size" ] && arg_table_size="--table-size=$table_size"

args="\
	--mysql-user=root\
	--mysql-db=mysql\
	--events=0\
	--threads=$nr_threads\
	--time=$runtime\
	$arg_table_size\
	oltp_read_only.lua\
"

cat > "$TMP_RESULT_ROOT"/run.oltp <<EOF
cd /usr/share/sysbench
log_cmd sysbench $args prepare
log_cmd sysbench $args run
log_cmd sysbench $args cleanup
killall -15 mysqld
EOF
